package com.pinyougou.sellergoods.service.impl;

import com.alibaba.druid.sql.ast.expr.SQLCaseExpr;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pinyougou.mapper.ItemCatMapper;
import com.pinyougou.pojo.TbGoods;
import com.pinyougou.pojo.TbItem;
import com.pinyougou.pojo.TbItemCat;
import com.pinyougou.sellergoods.service.GoodsService;
import com.pinyougou.sellergoods.service.ItemCatService;
import com.pinyougou.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Example;

import java.util.List;
@Service
public class ItemCatServiceImpl extends BaseServiceImpl<TbItemCat> implements ItemCatService {

    @Autowired
    private ItemCatMapper itemCatMapper;

    @Override
    public PageInfo<TbItemCat> search(Integer pageNum,Integer pageSize,TbItemCat tbItemCat) {
//        设置分页
        PageHelper.startPage(pageNum,pageSize);
//        创建查询对象
        Example example=new Example(TbItemCat.class);
//        创建查询条件对象
        Example.Criteria criteria = example.createCriteria();
        List<TbItemCat> tbItemCats = itemCatMapper.selectByExample(example);
        return new PageInfo<>(tbItemCats);
    }
}
